<template>
	<view class="container">
		<view style="flex: 1;">
			<view class="main">
				<view style="padding: 30rpx 34rpx 0;">
					<view class="step">
						<view class="title">
							<view>实名结果</view>
						</view>
					</view>
				</view>
				<view class="phone">
					<view style="padding: 90rpx 0 134rpx;font-size: 28rpx;color: #606266;">
						尊敬的{{info.realname||'-'}}， 你好
					</view>
					<view class="pic" v-if="info.verifyed_status==1">
						<image class="code" src="../../static/imgs/auth.png" mode="widthFix"></image>
						<view class="status success">实名成功</view>
					</view>
					<view class="pic" v-if="info.verifyed_status==2">
						<image class="code" src="../../static/imgs/auth_fail.png" mode="widthFix"></image>
						<view class="status fail">实名失败</view>
					</view>

				</view>
				<view class="user_info" v-if="info.verifyed_status==1">
					<view class="info">
						<view>姓 <span style="visibility: hidden;">姓姓</span>名：</view>
						<view>{{info.realname||'-'}}</view>
					</view>
					<view class="info">
						<view>身份证号：</view>
						<view>{{info.idcard_no||'-'}}</view>
					</view>
					<view class="info">
						<view>实名时间：</view>
						<view>{{$u.timeFormat(info.verified_time, 'yyyy/mm/dd/ hh:MM')}}</view>
					</view>

				</view>
				<view class="action" v-if="info.verifyed_status==2">
					<view class="tips">姓名和身份证号码不符</view>
					<view class="review_name" @click="goBack">
						重新实名
					</view>
				</view>
			</view>
		</view>
		<view class="copyright">
			Copyright © 2024-2025 中检集团 版权所有
		</view>
	</view>
</template>

<script>
	import {
		search_phone_api,
		wechat_result_api
	} from '@/common/api.js'
	import {
		Base64
	} from "@/js_sdk/js-base64/base64.js"
	export default {
		data() {
			return {
				phone: '',
				status: 1,
				info: {
					realname: '',
					idcard_no: '',
					verified_time: '',
					verifyed_status: ''
				},
				user_id: '',
				BizToken: ''
			}
		},
		onLoad({
			phone,
			user_id,
			BizToken
		}) {
			if (phone) {
				this.phone = Base64.decode(phone)
				this.getInfo(this.phone)
			}
			if (user_id && BizToken) {
				this.WeChatCallBack(user_id, BizToken)
			}
		},
		methods: {
			getInfo(
				phone
			) {
				search_phone_api({
					params: {
						phone
					}
				}).then(res => {
					this.info = res.data
				})
			},
			WeChatCallBack(user_id, BizToken) {
				wechat_result_api({
					user_id,
					BizToken
				}).then(res => {
					this.info = res.data
				})
			},
			goBack() {
				uni.navigateTo({
					url: `/pages/index/second?phone=${Base64.encode(this.phone||this.info.phone)}`
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.container {
		flex: 1;
		padding: 52rpx 24rpx 0;
		display: flex;
		flex-direction: column;

		.main {
			background-color: #fff;
			border-radius: 8rpx 8rpx 8rpx 8rpx;
			padding-bottom: 26rpx;

			.step {
				border-bottom: 2rpx solid #E7E7E7;
				display: flex;
				justify-content: space-between;
				padding-bottom: 20rpx;


				.title {
					display: flex;
					font-size: 36rpx;
					font-weight: 500;
					color: #303133;
					line-height: 56rpx;
				}

				.num {
					font-size: 32rpx;
					font-weight: 500;
					color: #303133;
					line-height: 56rpx;
				}
			}

			.phone {

				margin: 0 34rpx;

				.pic {
					display: flex;
					flex-direction: column;
					justify-content: center;
					align-items: center;
				}

				.code {
					width: 312rpx;
				}

				.status {
					font-size: 48rpx;
					font-weight: 500;

				}

				.success {
					color: #57EC31;
				}

				.fail {
					color: #F5222D;
				}




				.submit {
					width: 196rpx;
					height: 80rpx;
					line-height: 80rpx;
					background: #43B0E8;
					border-radius: 8rpx 8rpx 8rpx 8rpx;
					font-size: 32rpx;
					color: #fff;
					text-align: center;
					margin: 0 auto;
					margin-top: 128rpx;
					margin-bottom: 74rpx;
				}
			}

			.user_info {
				margin: 0 34rpx;
				font-size: 28rpx;
				color: #909399;
				padding-top: 110rpx;


				.info {
					line-height: 50rpx;
					padding: 8rpx 0;
					display: flex;
					align-items: center;
				}
			}

			.action {
				padding: 66rpx 0 86rpx;

				.tips {
					font-size: 28rpx;
					font-family: PingFang SC, PingFang SC;
					font-weight: 400;
					color: #606266;
					text-align: center;
					padding-bottom: 76rpx;
				}

				.review_name {
					width: 196rpx;
					height: 80rpx;
					line-height: 80rpx;
					background: #43B0E8;
					border-radius: 8rpx 8rpx 8rpx 8rpx;
					font-size: 32rpx;
					font-weight: 500;
					color: #FFFFFF;
					margin: 0 auto;
					text-align: center;
				}
			}

		}

		.copyright {
			margin-top: 154rpx;
			padding-bottom: 34rpx;
			font-size: 28rpx;
			color: #FFFFFF;
			text-align: center;
		}
	}
</style>